package com.mtz.controller;

import com.mtz.VO.ResultVO;
import com.mtz.dateobject.QuestionHistory;
import com.mtz.service.QuestionHistoryService;
import com.mtz.utils.ResultVOUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 煜赜
 * @date 2018/12/10 0010 上午 9:37
 */
@Api(description = "历史记录")
@RestController
@RequestMapping("/history")
public class QuestionHistoryController {

    @Autowired
    private QuestionHistoryService questionHistoryService;

    @ApiOperation(value = "查找questionId问答的历史", notes = "查找问答历史记录")
    @GetMapping("/questionId")
    public ResultVO findById(@ApiParam(value = "问题id",required = true)
                             @RequestParam("questionId") Integer questionId) {
        List<QuestionHistory> questionHistoryList = questionHistoryService.findByQuestionId(questionId);
        return ResultVOUtil.success(questionHistoryList);
    }
}
